<include file="Public:header_new"/>
<div class="usernewout">
<div class="usncont">
    <!--左侧菜单-->
    <include file="User:left"/>
    <!--右侧内容-->
     <style>
  .active {background: #000;font-size: 14px;color: #059ff5;line-height: 39px;}
  .tiaozhuan {display: block;width: 100px;height: 39px;font-size: 14px;color: #7b8a9d;line-height: 39px;text-align: center;float: left;}
  </style>
  <div class="aqsz">
        <a href="{:U('User/index')}" class="tiaozhuan">{$Think.lang.g_account}</a>
        <a href="{:U('User/nameauth')}" class="tiaozhuan ">{$Think.lang.g_shimingrz}</a>
        <a href="{:U('User/ga')}" class="tiaozhuan ">{$Think.lang.g_gugerz}</a>
        <a href="{:U('User/email')}" class="tiaozhuan active">{$Think.lang.g_youxiangrz}</a>
        <a href="{:U('User/password')}" class="tiaozhuan">{$Think.lang.g_denglumm}</a>
        <a href="{:U('User/paypassword')}" class="tiaozhuan">{$Think.lang.g_jiaoyimm}</a>
        <a href="{:U('User/mibao')}" class="tiaozhuan">{$Think.lang.g_mbquestion}</a>
        <!-- <a href="{:U('User/log')}" class="tiaozhuan">登录日志</a>
        <a href="{:U('User/feedbacklist')}" class="tiaozhuan">我的工单</a> -->
  </div>
    <div class="usnc_right">
    <div class="nameauth">
		<h1 style="text-align:center;font-size: 16px;line-height: 50px;">{$Think.lang.g_yx_bind}</h1>
        <div class="rech_top">
            <div class="rech_box">
                <empty name="user['email']">
                    <form>
                        <div class="rech_bd safe_rech_bd">
							<ul>
								<li>
									<div class="rechmid">
                            <div class="rechipt_box">
                                <label>{$Think.lang.g_yx_number}：</label>
                                <div class="iptbox">
                                    <input type="text" class="rechipt" id="email" value="" />
                                </div>
                            </div>
							<div class="rechipt_box">
								<label>{$Think.lang.g_yx_verify}：</label>
								<div class="iptbox">
									<input type="text" id="email_verify" value="" class="rechipt halfipt">
									<input type="button" id="regBtn" onclick="EmCode()" value="{$Think.lang.g_yx_rec_verify}" class="yzmbut">
								</div>
							</div>
                            <div class="rechipt_box">
                                <div class="iptbox mrl110">
                                    <input type="button" class="rechbut" value="{$Think.lang.g_yx_binds}" title="{$Think.lang.g_yx_binds}"  id="btn-up" onclick="Update()" />
                                </div>
                            </div>
									</div>
								</li>
							</ul>
                        </div>
                    </form>
                <else/>
					<div class="rech_bd safe_rech_bd">
						<ul>
							<li>
								<div class="rechmid">
									<div class="rechipt_box">
										<div class="band_succ" style="margin-left: 20px;vertical-align: middle;">
										   <img src="__PUBLIC__/Home/images/images/xz22.png" alt="" style="vertical-align: middle;margin-right: 5px;">
										   {$Think.lang.g_yx_has_bind}
										</div>
									</div>
									<div class="rechipt_box">
										<label>{$Think.lang.g_yx_number}：</label>
										<div class="iptbox">
											<input type="text" value="{$user.email}" class="rechipt" readonly/>
										</div>
									</div>
								</div>
							</li>
						</ul>
					</div>
                </empty>
            </div>
        </div>
    </div>
</div>
</div>
</div>
<script type="text/javascript">
function EmCode(){
	var email = $("#email").val();
	if (email == "" || email == null) {
		layer.tips(' {$Think.lang.g_yx_put}', '#email', {tips: 3});
		return false;
	}
	layer.load(0, {shade: [0.5,'#8F8F8F']});
	$.post("{:U('Verify/emailbd')}", {
		email: email
	}, function (data) {
		layer.closeAll();
		if (data.status == 1) {
			//刷新验证码
			$('#regBtn').attr("disabled", "disabled");
			layer.msg(data.info, {icon: 1});
			var obj = $('#regBtn');
			var wait = 60;
			var interval = setInterval(function () {
				obj.css('backgroundColor', '#f6f6f6');
				obj.val(wait + ' {$Think.lang.Finance_again}');
				wait--;
				if (wait < 0) {
					$('#regBtn').removeAttr("disabled");
					clearInterval(interval);
					obj.val(' {$Think.lang.Finance_hqyzm2}');
					obj.css('backgroundColor', '#f6f6f6');
				}
				;
			}, 1000);
		} else {
			//刷新验证码
			layer.msg(data.info, {icon: 2});
			$('#regBtn').removeAttr("disabled");
			if (data.url) {
				window.location = data.url;
			}
		}
	}, "json");
}
function Update() {
	var email = $("#email").val();
	var email_verify = $("#email_verify").val();
	if (email == "" || email == null) {
		layer.tips('{$Think.lang.g_yx_puts}', '#email', {tips: 3});
		return false;
	}
	if (email_verify == "" || email_verify == null) {
		layer.tips('{$Think.lang.g_yx_put_verfy}', '#email_verify', {tips: 3});
		return false;
	}
	$.post("{:U('User/upemail')}", {
		email: email,
		email_verify: email_verify
	}, function (data) {
		if (data.status == 1) {
			layer.msg(data.info, {icon: 1});
			window.location = "{:U('User/email')}";
		} else {
			layer.msg(data.info, {icon: 2});
			if (data.url) {
				window.location = data.url;
			}
		}
	}, "json");
}
//菜单高亮
$('#user_index').addClass('on');
</script>
<include file="Public:footer_new"/>